//
//  KLTabBarVC.m
//  KISSLOCK
//
//  Created by 陈宾鹏 on 16/10/13.
//  Copyright © 2016年 陈宾鹏. All rights reserved.
//

#import "KLTabBarVC.h"
#import "BBRSACryptor.h"
#import "GTMBase64.h"
#import "RSA_C.h"
#import "NSData+hex.h"
#import "NSString+Hex.h"
#import "HemaConst.h"
#import "AppDelegate.h"

static UITabBarController *tabBarVC;
@implementation KLTabBarVC
+(UITabBarController *)sharedTabBarVC{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSLog(@"一次");
        tabBarVC = [[UITabBarController alloc]init];
        tabBarVC.tabBar.backgroundColor = [UIColor colorWithRed:8 green:128 blue:181 alpha:1];
    });

//    
//    BBRSACryptor *rsaCryptor = [[BBRSACryptor alloc] init];
//    [rsaCryptor generateRSAKeyPairWithKeySize:1024];
//    
//    // 获取公钥、私钥
//    NSString *publicKey = [rsaCryptor PEMFormatPublicKey];
//    NSLog(@"随机生成的公钥:%@",publicKey);
//    
//    NSString *str = @"left";
//    NSData *left = [str dataUsingEncoding:NSUTF8StringEncoding];
//    NSLog(@"原始数据:%@",left);
//    NSData *jiami = [rsaCryptor encryptWithPublicKeyUsingPadding:RSA_PKCS1_OAEP_PADDING plainData:left];
//    NSLog(@"加密的数据:%@",jiami);
//    NSData *jiemi = [rsaCryptor decryptWithPrivateKeyUsingPadding:RSA_PKCS1_OAEP_PADDING cipherData:jiami];
//    NSLog(@"解密数据:%@,长度:%zd",jiemi,jiemi.length);
//    NSString *str1 = [[NSString alloc]initWithData:jiemi encoding:NSUTF8StringEncoding];
//    NSLog(@"******%@",str1);
    
/*pkcs#8*/
//    NSString *gongyue = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXH3S/+SxUR9qqioauLR+nhCilCKTijLWX7aMSPqzLPC4Vw44vXuyPp3qfxc9cq1eWk2QwgsBRpvqPrj4940gBHn+RckfrGKpCtNzZZ6U0IkWILdDLDQRuCRs9kR7VZ61+B8DIOIsKHYN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C2gDEgixhPXX0aW6LdXmEWx9cmeNO3ygzqFguEKwqnrNKSVDyelG/V0z2QIDAQAB";
//    NSString *siyue = @"MIICXAIBAAKBgQDVNTCXrPQxHEB0dF6emldlq6QAz6vk/aobl6BQAHlWfZ0jWOWwhbVeMkliTQy/vGsWXTdSNtkjQtrVfIYWn2UDf+hPvbhp9qFbAqTcs24YSdy/8RNvPjvjeu3m7E3TqUHHI/eMGKYYeEtwGKIFMV8OdxKtBr31Ger0Jrukr4TjEQIDAQABAoGAK06ikCyRbWhPr1fz4EN5fS1gIsoMIHdmFjS2W4m9G9RoFsX34eNG89tDDLSZ4lhjaCeHFSwO7xqlWLfyhKXb3nsPWrtj4LUaVSGsvMJgmuEFbssxuMEvv69yVMokAn1MbLYDDhvBeO0oq1U2Svh4bbyoJzfDWFhWsLvaN01mUAECQQD2vN790WCtsKyio/3alkFGabzXa7gY1sGnU4uoDmZXiVW0Cw7KPj13IL6zO140ZyQx+sbMP/CBABXx+CCyqR4PAkEA3TYZKItrRBzKwm3S3TOVwF3I7y8GKsUdiMuBfQBqN5Zni1AaQJFNzNQRb9TNeTXzGF1c/9PcriqxirT+TYUM3wJAcMe8FcCStFHBV0YmTrfHdmv2iXEPYSsosVcayuJqHTEFH5q+U+tHJSCuijZkxQcwIDhEji/buttTLJsCNyfeOQJBAKYXc2Zc4ApBMAAyI4wQqlTIVhE4loHQhK9sVWo8wIPCOzZ/y2ZFc0viwsDb3/ctibv2hdhUA7MFvU5vPS2JQ7MCQGCxlBjjJq7Dauj2JSn9nq6MkKmHMljjGSoSPLTgpywD5hLnzFm04ZMTb/abKeppep/fIG3r6Kf0RUfO2WPK6rc=";

//    NSData *jiami = [RSA_C encryptData:left publicKey:gongyue];
//    NSLog(@"加密的数据:%@,长度:%zd",jiami,jiami.length);
//    NSData *jiemi = [RSA_C decryptData:jiami privateKey:siyue];
//    NSLog(@"解密数据:%@",jiemi);


    NSLog(@"%@",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]);
//
    return tabBarVC;
}

@end
